package com.spic.business.riskbase.hierarchy.controller;

import com.spic.business.riskbase.hierarchy.domain.*;
import com.spic.business.riskbase.hierarchy.service.IDealDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 赵祥
 * create at:  2023/4/15  15:15
 * @Description :
 **/
@RestController
@Transactional(rollbackFor = Exception.class)
@RequestMapping("/risk/dealdata")
public class DealDataController {


    @Autowired
    private IDealDataService dealDataService;

    /**
     * 插入作业步骤
     * /risk/dealdata/insertWorkStep?parentDeptId=276
     */
    @GetMapping("/insertWorkStep")
    void insertWorkStep(RiskWorkTask riskWorkTask) {
        dealDataService.insertWorkStep(riskWorkTask);
    }

    /**
     * 插入危险源
     * /risk/dealdata/inserDangerSource?parentDeptId=276
     */
    @GetMapping("/inserDangerSource")
    void inserDangerSource(RiskWorkStep riskWorkStep) {
        dealDataService.inserDangerSource(riskWorkStep);
    }

    /**
     * 插入风险描述
     * /risk/dealdata/inserRiskDescription?parentDeptId=276
     */
    @GetMapping("/inserRiskDescription")
    void inserDangerSource(RiskDangerSource riskDangerSource) {
        dealDataService.inserRiskDescription(riskDangerSource);
    }

    /**
     * 插入风险分析
     * /risk/dealdata/inserRiskAnalyse?parentDeptId=276
     */
    @GetMapping(value = "/inserRiskAnalyse")
    void inserRiskAnalyse(RiskDescription riskDescription) {
        dealDataService.inserRiskAnalyse(riskDescription);
    }

    /**
     * 插入后果及影响、风险等级、管控措施等最小单元
     * /risk/dealdata/inserRiskDetails?parentDeptId=276
     */
    @GetMapping("/inserRiskDetails")
    void inserRiskDetails(RiskAnalyse riskAnalyse) {
        dealDataService.inserRiskDetails(riskAnalyse);
    }
}
